﻿using Batman.Maintenance.Repositories;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;

namespace Batman.Maintenance.Extensions
{
    public static class ServiceCollectionExtension
    {
        public static void AddMaintenance<TDbContext>(this IServiceCollection services)
            where TDbContext : DbContext
        {
            services.AddScoped(typeof(DbContextFactory<>), typeof(DbContextFactory<>));
            services.AddScoped(typeof(MaintenanceRepository<>), typeof(MaintenanceRepository<>));
            services.AddScoped(typeof(MyDbContext), typeof(TDbContext));
        }
    }
}
